package com.lzc.springboot.mapper;

import com.lzc.springboot.domain.TemporaryPicture;
import org.apache.ibatis.annotations.*;

@Mapper
public interface TemporaryPicMapper {

  /**
   * 存储临时图片
   * @param temporaryPicture
   * @return
   */
  @Insert("insert into temporary_pic values(null,#{picName},#{pic},null)")
  @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
  void save(TemporaryPicture temporaryPicture);

  /**
   * 删除临时图片
   * @param temporaryPicture
   */
  @Delete("delete from temporary_pic where id=#{id}")
  void delete(TemporaryPicture temporaryPicture);

  /**
   * 根据图片Id查询病害类别
   * @param id
   * @return
   */
  @Select("select tolDiseaseClass from temporary_pic where id=#{id}")
  @Options(useCache = false, flushCache = Options.FlushCachePolicy.TRUE)
  Integer findClassById(int id);
}
